//
//  CellSectionZeroForVCOfCellForExploreSectionOne.m
//  echo
//
//  Created by dllo on 16/3/12.
//  Copyright © 2016年 Danny. All rights reserved.
//

#define WIDTH [UIScreen mainScreen].bounds.size.width / 414
#define HEIGHT [UIScreen mainScreen].bounds.size.height / 736

#import "CellSectionZeroForVCOfCellForExploreSectionOne.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "ModelOfCellSectionZeroForVCOfCellForExploreSectionOne.h"
#import <DKNightVersion.h>

@interface CellSectionZeroForVCOfCellForExploreSectionOne ()
@property (nonatomic, retain)UIView *backView;
@property (nonatomic, retain)UIImageView *imageViewForBack;
@property (nonatomic, retain)UILabel *labelForLeft;
@property (nonatomic, retain)UIView *viewOfLineForLeft;
@property (nonatomic, retain)UILabel *labelForMid;
@property (nonatomic, retain)UIView *viewOfLineForRight;
@property (nonatomic, retain)UILabel *labelForRight;
@property (nonatomic, retain)UILabel *labelForLeftBottom;
@property (nonatomic, retain)UILabel *labelForMidBottom;
@property (nonatomic, retain)UILabel *labelForRightBottom;
@property (nonatomic, retain)UILabel *labelForContent;
@property (nonatomic, retain)UIView *alphaView;
@end

@implementation CellSectionZeroForVCOfCellForExploreSectionOne

- (void)dealloc{
    [_backView release];
    [_imageViewForBack release];
    [_labelForLeft release];
    [_viewOfLineForLeft release];
    [_labelForMid release];
    [_viewOfLineForRight release];
    [_labelForRight release];
    [_labelForLeftBottom release];
    [_labelForMidBottom release];
    [_labelForRightBottom release];
    [_labelForContent release];
    [_alphaView release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backView = [[UIView alloc]init];
        [self.contentView addSubview:self.backView];
        [self.backView release];
        
        self.imageViewForBack = [[UIImageView alloc]init];
        [self.backView addSubview:self.imageViewForBack];
        [self.imageViewForBack release];
        
        self.alphaView = [[UIView alloc]init];
        [self.backView addSubview:self.alphaView];
        [self.alphaView release];
        
        self.labelForLeft = [[UILabel alloc]init];
        [self.backView addSubview:self.labelForLeft];
        [self.labelForLeft release];
        
        self.viewOfLineForLeft = [[UIView alloc]init];
        [self.backView addSubview:self.viewOfLineForLeft];
        [self.viewOfLineForLeft release];
        
        self.labelForMid = [[UILabel alloc]init];
        [self.backView addSubview:self.labelForMid];
        [self.labelForMid release];
        
        self.viewOfLineForRight = [[UIView alloc]init];
        [self.backView addSubview:self.viewOfLineForRight];
        [self.viewOfLineForRight release];
        
        self.labelForRight = [[UILabel alloc]init];
        [self.backView addSubview:self.labelForRight];
        [self.labelForRight release];
        
        self.labelForLeftBottom = [[UILabel alloc]init];
        [self.backView addSubview:self.labelForLeftBottom];
        [self.labelForLeftBottom release];
        
        self.labelForMidBottom = [[UILabel alloc]init];
        [self.backView addSubview:self.labelForMidBottom];
        [self.labelForMidBottom release];
        
        self.labelForRightBottom = [[UILabel alloc]init];
        [self.backView addSubview:self.labelForRightBottom];
        [self.labelForRightBottom release];
        
        self.labelForContent = [[UILabel alloc]init];
        [self.backView addSubview:self.labelForContent];
        [self.labelForContent release];
    }
    return self;
}

- (void)layoutSubviews{
    
    [super layoutSubviews];
    self.backView.frame = self.contentView.frame;
    self.backView.dk_backgroundColorPicker = DKColorWithColors([UIColor whiteColor], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
    self.imageViewForBack.frame = CGRectMake(0, 0, self.contentView.frame.size.width, 260 * HEIGHT);

    self.alphaView.frame =  CGRectMake(0, 260 * HEIGHT - 55 * HEIGHT, self.contentView.frame.size.width, self.contentView.frame.size.height - 280 * HEIGHT);
    self.alphaView.backgroundColor = [UIColor blackColor];

    self.alphaView.alpha = 0.7;
    
    
    self.labelForLeft.frame = CGRectMake(10 * WIDTH, 260 * HEIGHT - 50 * HEIGHT, (self.contentView.frame.size.width - 40 * WIDTH) / 3 , 25 * HEIGHT);
    self.labelForLeft.textAlignment = 1;
    self.labelForLeft.font = [UIFont fontWithName:@"Arial" size:15];
    self.labelForLeft.textColor = [UIColor whiteColor];
    
    self.labelForLeftBottom.frame = CGRectMake(10 * WIDTH, 290 * HEIGHT - 55 * HEIGHT, (self.contentView.frame.size.width - 40 * WIDTH) / 3, 25 * HEIGHT);
    self.labelForLeftBottom.textAlignment = 1;
    self.labelForLeftBottom.font = [UIFont fontWithName:@"Arial" size:15];
    self.labelForLeftBottom.text = @"声音";
    self.labelForLeftBottom.textColor = [UIColor whiteColor];
    
    self.viewOfLineForLeft.frame = CGRectMake((self.contentView.frame.size.width - 40 * WIDTH) / 3 + 10 * WIDTH + 4.5 * WIDTH, 265 * HEIGHT - 50 * HEIGHT, 1 * WIDTH, 40 * HEIGHT);
    self.viewOfLineForLeft.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor whiteColor]);
    
    self.labelForMid.frame = CGRectMake(10 * WIDTH + (self.contentView.frame.size.width - 40 * WIDTH) / 3 + 10 * WIDTH, 260 * HEIGHT - 50 * HEIGHT, (self.contentView.frame.size.width - 40 * WIDTH) / 3, 25 * HEIGHT);
    self.labelForMid.textAlignment = 1;
    self.labelForMid.font = [UIFont fontWithName:@"Arial" size:15];
    self.labelForMid.textColor = [UIColor whiteColor];
    
    self.labelForMidBottom.frame = CGRectMake(10 * WIDTH + (self.contentView.frame.size.width - 40 * WIDTH) / 3 + 10 * WIDTH, 290 * HEIGHT- 55 * HEIGHT, (self.contentView.frame.size.width - 40 * WIDTH) / 3, 25 * HEIGHT);
    self.labelForMidBottom.textAlignment = 1;
    self.labelForMidBottom.font = [UIFont fontWithName:@"Arial" size:15];
    self.labelForMidBottom.text = @"关注";
    self.labelForMidBottom.textColor = [UIColor whiteColor];
    
    self.viewOfLineForRight.frame = CGRectMake(10 * WIDTH + (self.contentView.frame.size.width - 40 * WIDTH) / 3 * 2 + 10 * WIDTH + 4.5 * WIDTH, 265 * HEIGHT - 50 * HEIGHT, 1 * WIDTH, 40 * HEIGHT);
    self.viewOfLineForRight.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor whiteColor]);
    self.labelForRight.frame = CGRectMake(10 * WIDTH + (self.contentView.frame.size.width - 40 * WIDTH) / 3 * 2 + 10 * WIDTH + 10 * WIDTH, 260 * HEIGHT - 50 * HEIGHT, (self.contentView.frame.size.width - 40 * WIDTH) / 3, 25 * HEIGHT);
    self.labelForRight.textAlignment = 1;
    self.labelForRight.font = [UIFont fontWithName:@"Arial" size:15];
    self.labelForRight.textColor = [UIColor whiteColor];
    
    self.labelForRightBottom.frame = CGRectMake(10 * WIDTH + (self.contentView.frame.size.width - 40 * WIDTH) / 3 * 2 + 10 * WIDTH + 10 * WIDTH, 290 * HEIGHT - 55 * HEIGHT, (self.contentView.frame.size.width - 40 * WIDTH) / 3, 25 * HEIGHT);
    self.labelForRightBottom.textAlignment = 1;
    self.labelForRightBottom.font = [UIFont fontWithName:@"Arial" size:15];
    self.labelForRightBottom.text = @"分享";
    self.labelForRightBottom.textColor = [UIColor whiteColor];
    
    self.labelForContent.frame = CGRectMake(5 * WIDTH, 320 * HEIGHT - 55 * HEIGHT, self.contentView.frame.size.width - 10 * WIDTH, 65 * HEIGHT);
    self.labelForContent.font = [UIFont fontWithName:@"Arial" size:15];
    self.labelForContent.numberOfLines = 0;
    self.labelForContent.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
}

- (void)passModel:(ModelOfCellSectionZeroForVCOfCellForExploreSectionOne *)model {
    [self.imageViewForBack sd_setImageWithURL:[NSURL URLWithString:model.pic]];
    NSString *str1 = [NSString stringWithFormat:@"%ld", (long)model.sound_count];
    NSString *str2 = [NSString stringWithFormat:@"%ld", (long)model.follow_count];
    NSString *str3 = [NSString stringWithFormat:@"%ld", (long)model.share_count];
    self.labelForLeft.text = str1;
    self.labelForMid.text = str2;
    self.labelForRight.text = str3;
    self.labelForContent.text = model.info;
    
//    self.labelForLeft.text = ;
//    self.labelForMid.text = model.follow_count;
//    self.labelForRight.text = model.share_count;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
